3.219 \(\int \frac {\tan ^2(e+f x)}{a+b \tan ^2(e+f x)} \, dx\)

Optimal. Leaf size=50 \[ \frac {\sqrt {a} \tan ^{-1}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a}}\right )}{\sqrt {b} f (a-b)}-\frac {x}{a-b} \]

[Out]

-x/(a-b)+arctan(b^(1/2)*tan(f*x+e)/a^(1/2))*a^(1/2)/(a-b)/f/b^(1/2)

________________________________________________________________________________________

Rubi [A]  time = 0.08, antiderivative size = 50, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.174, Rules used = {3670, 481, 203, 205} \[ \frac {\sqrt {a} \tan ^{-1}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a}}\right )}{\sqrt {b} f (a-b)}-\frac {x}{a-b} \]

Antiderivative was successfully verified.

[In]

Int[Tan[e + f*x]^2/(a + b*Tan[e + f*x]^2),x]

[Out]

-(x/(a - b)) + (Sqrt[a]*ArcTan[(Sqrt[b]*Tan[e + f*x])/Sqrt[a]])/((a - b)*Sqrt[b]*f)

Rule 203

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTan[(Rt[b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 205

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]*ArcTan[x/Rt[a/b, 2]])/a, x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rule 481

Int[((e_.)*(x_))^(m_.)/(((a_) + (b_.)*(x_)^(n_))*((c_) + (d_.)*(x_)^(n_))), x_Symbol] :> -Dist[(a*e^n)/(b*c -
a*d), Int[(e*x)^(m - n)/(a + b*x^n), x], x] + Dist[(c*e^n)/(b*c - a*d), Int[(e*x)^(m - n)/(c + d*x^n), x], x]
/; FreeQ[{a, b, c, d, e, m}, x] && NeQ[b*c - a*d, 0] && IGtQ[n, 0] && LeQ[n, m, 2*n - 1]

Rule 3670

Int[((d_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol]
 :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist[(c*ff)/f, Subst[Int[(((d*ff*x)/c)^m*(a + b*(ff*x)^n)^p)/(c^
2 + ff^2*x^2), x], x, (c*Tan[e + f*x])/ff], x]] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && (IGtQ[p, 0] || EqQ
[n, 2] || EqQ[n, 4] || (IntegerQ[p] && RationalQ[n]))

Rubi steps

\begin {align*} \int \frac {\tan ^2(e+f x)}{a+b \tan ^2(e+f x)} \, dx &=\frac {\operatorname {Subst}\left (\int \frac {x^2}{\left (1+x^2\right ) \left (a+b x^2\right )} \, dx,x,\tan (e+f x)\right )}{f}\\ &=-\frac {\operatorname {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\tan (e+f x)\right )}{(a-b) f}+\frac {a \operatorname {Subst}\left (\int \frac {1}{a+b x^2} \, dx,x,\tan (e+f x)\right )}{(a-b) f}\\ &=-\frac {x}{a-b}+\frac {\sqrt {a} \tan ^{-1}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a}}\right )}{(a-b) \sqrt {b} f}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.03, size = 49, normalized size = 0.98 \[ \frac {\tan ^{-1}(\tan (e+f x))-\frac {\sqrt {a} \tan ^{-1}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a}}\right )}{\sqrt {b}}}{b f-a f} \]

Antiderivative was successfully verified.

[In]

Integrate[Tan[e + f*x]^2/(a + b*Tan[e + f*x]^2),x]

[Out]

(ArcTan[Tan[e + f*x]] - (Sqrt[a]*ArcTan[(Sqrt[b]*Tan[e + f*x])/Sqrt[a]])/Sqrt[b])/(-(a*f) + b*f)

________________________________________________________________________________________

fricas [A]  time = 0.45, size = 181, normalized size = 3.62 \[ \left [-\frac {4 \, f x + \sqrt {-\frac {a}{b}} \log \left (\frac {b^{2} \tan \left (f x + e\right )^{4} - 6 \, a b \tan \left (f x + e\right )^{2} + a^{2} - 4 \, {\left (b^{2} \tan \left (f x + e\right )^{3} - a b \tan \left (f x + e\right )\right )} \sqrt {-\frac {a}{b}}}{b^{2} \tan \left (f x + e\right )^{4} + 2 \, a b \tan \left (f x + e\right )^{2} + a^{2}}\right )}{4 \, {\left (a - b\right )} f}, -\frac {2 \, f x - \sqrt {\frac {a}{b}} \arctan \left (\frac {{\left (b \tan \left (f x + e\right )^{2} - a\right )} \sqrt {\frac {a}{b}}}{2 \, a \tan \left (f x + e\right )}\right )}{2 \, {\left (a - b\right )} f}\right ] \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(f*x+e)^2/(a+b*tan(f*x+e)^2),x, algorithm="fricas")

[Out]

[-1/4*(4*f*x + sqrt(-a/b)*log((b^2*tan(f*x + e)^4 - 6*a*b*tan(f*x + e)^2 + a^2 - 4*(b^2*tan(f*x + e)^3 - a*b*t
an(f*x + e))*sqrt(-a/b))/(b^2*tan(f*x + e)^4 + 2*a*b*tan(f*x + e)^2 + a^2)))/((a - b)*f), -1/2*(2*f*x - sqrt(a
/b)*arctan(1/2*(b*tan(f*x + e)^2 - a)*sqrt(a/b)/(a*tan(f*x + e))))/((a - b)*f)]

________________________________________________________________________________________

giac [A]  time = 2.08, size = 67, normalized size = 1.34 \[ \frac {\frac {{\left (\pi \left \lfloor \frac {f x + e}{\pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\relax (b) + \arctan \left (\frac {b \tan \left (f x + e\right )}{\sqrt {a b}}\right )\right )} a}{\sqrt {a b} {\left (a - b\right )}} - \frac {f x + e}{a - b}}{f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(f*x+e)^2/(a+b*tan(f*x+e)^2),x, algorithm="giac")

[Out]

((pi*floor((f*x + e)/pi + 1/2)*sgn(b) + arctan(b*tan(f*x + e)/sqrt(a*b)))*a/(sqrt(a*b)*(a - b)) - (f*x + e)/(a
 - b))/f

________________________________________________________________________________________

maple [A]  time = 0.16, size = 52, normalized size = 1.04 \[ \frac {a \arctan \left (\frac {\tan \left (f x +e \right ) b}{\sqrt {a b}}\right )}{f \left (a -b \right ) \sqrt {a b}}-\frac {\arctan \left (\tan \left (f x +e \right )\right )}{f \left (a -b \right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(f*x+e)^2/(a+b*tan(f*x+e)^2),x)

[Out]

1/f*a/(a-b)/(a*b)^(1/2)*arctan(tan(f*x+e)*b/(a*b)^(1/2))-1/f/(a-b)*arctan(tan(f*x+e))

________________________________________________________________________________________

maxima [A]  time = 0.74, size = 47, normalized size = 0.94 \[ \frac {\frac {a \arctan \left (\frac {b \tan \left (f x + e\right )}{\sqrt {a b}}\right )}{\sqrt {a b} {\left (a - b\right )}} - \frac {f x + e}{a - b}}{f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(f*x+e)^2/(a+b*tan(f*x+e)^2),x, algorithm="maxima")

[Out]

(a*arctan(b*tan(f*x + e)/sqrt(a*b))/(sqrt(a*b)*(a - b)) - (f*x + e)/(a - b))/f

________________________________________________________________________________________

mupad [B]  time = 11.57, size = 135, normalized size = 2.70 \[ -\frac {2\,\mathrm {atan}\left (\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (2\,a^2\,b+2\,b^3\right )+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (-8\,a^3\,b^2+8\,a^2\,b^3+8\,a\,b^4-8\,b^5\right )}{{\left (2\,a-2\,b\right )}^2}}{a\,b\,\left (2\,a-2\,b\right )}\right )}{f\,\left (2\,a-2\,b\right )}-\frac {\mathrm {atanh}\left (\frac {\mathrm {tan}\left (e+f\,x\right )\,\sqrt {-a\,b}}{a}\right )\,\sqrt {-a\,b}}{f\,\left (a\,b-b^2\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(e + f*x)^2/(a + b*tan(e + f*x)^2),x)

[Out]

- (2*atan((tan(e + f*x)*(2*a^2*b + 2*b^3) + (tan(e + f*x)*(8*a*b^4 - 8*b^5 + 8*a^2*b^3 - 8*a^3*b^2))/(2*a - 2*
b)^2)/(a*b*(2*a - 2*b))))/(f*(2*a - 2*b)) - (atanh((tan(e + f*x)*(-a*b)^(1/2))/a)*(-a*b)^(1/2))/(f*(a*b - b^2)
)

________________________________________________________________________________________

sympy [A]  time = 2.29, size = 292, normalized size = 5.84 \[ \begin {cases} \tilde {\infty } x & \text {for}\: a = 0 \wedge b = 0 \wedge f = 0 \\\frac {x}{b} & \text {for}\: a = 0 \\\frac {f x \tan ^{2}{\left (e + f x \right )}}{2 b f \tan ^{2}{\left (e + f x \right )} + 2 b f} + \frac {f x}{2 b f \tan ^{2}{\left (e + f x \right )} + 2 b f} - \frac {\tan {\left (e + f x \right )}}{2 b f \tan ^{2}{\left (e + f x \right )} + 2 b f} & \text {for}\: a = b \\\frac {x \tan ^{2}{\relax (e )}}{a + b \tan ^{2}{\relax (e )}} & \text {for}\: f = 0 \\\frac {- x + \frac {\tan {\left (e + f x \right )}}{f}}{a} & \text {for}\: b = 0 \\- \frac {2 i \sqrt {a} b f x \sqrt {\frac {1}{b}}}{2 i a^{\frac {3}{2}} b f \sqrt {\frac {1}{b}} - 2 i \sqrt {a} b^{2} f \sqrt {\frac {1}{b}}} + \frac {a \log {\left (- i \sqrt {a} \sqrt {\frac {1}{b}} + \tan {\left (e + f x \right )} \right )}}{2 i a^{\frac {3}{2}} b f \sqrt {\frac {1}{b}} - 2 i \sqrt {a} b^{2} f \sqrt {\frac {1}{b}}} - \frac {a \log {\left (i \sqrt {a} \sqrt {\frac {1}{b}} + \tan {\left (e + f x \right )} \right )}}{2 i a^{\frac {3}{2}} b f \sqrt {\frac {1}{b}} - 2 i \sqrt {a} b^{2} f \sqrt {\frac {1}{b}}} & \text {otherwise} \end {cases} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(f*x+e)**2/(a+b*tan(f*x+e)**2),x)

[Out]

Piecewise((zoo*x, Eq(a, 0) & Eq(b, 0) & Eq(f, 0)), (x/b, Eq(a, 0)), (f*x*tan(e + f*x)**2/(2*b*f*tan(e + f*x)**
2 + 2*b*f) + f*x/(2*b*f*tan(e + f*x)**2 + 2*b*f) - tan(e + f*x)/(2*b*f*tan(e + f*x)**2 + 2*b*f), Eq(a, b)), (x
*tan(e)**2/(a + b*tan(e)**2), Eq(f, 0)), ((-x + tan(e + f*x)/f)/a, Eq(b, 0)), (-2*I*sqrt(a)*b*f*x*sqrt(1/b)/(2
*I*a**(3/2)*b*f*sqrt(1/b) - 2*I*sqrt(a)*b**2*f*sqrt(1/b)) + a*log(-I*sqrt(a)*sqrt(1/b) + tan(e + f*x))/(2*I*a*
*(3/2)*b*f*sqrt(1/b) - 2*I*sqrt(a)*b**2*f*sqrt(1/b)) - a*log(I*sqrt(a)*sqrt(1/b) + tan(e + f*x))/(2*I*a**(3/2)
*b*f*sqrt(1/b) - 2*I*sqrt(a)*b**2*f*sqrt(1/b)), True))

________________________________________________________________________________________